package com.javandad.app.client.cells;

import com.google.gwt.cell.client.AbstractCell;
import com.google.gwt.safehtml.shared.SafeHtmlBuilder;
import com.javandad.app.shared.entity.project.ProjectAssoc;

public class ProjectCell extends AbstractCell<ProjectAssoc> {

	@Override
	public void render(com.google.gwt.cell.client.Cell.Context context, ProjectAssoc value, SafeHtmlBuilder sb) {

		ProjectAssoc p = (ProjectAssoc) value;
		sb.appendHtmlConstant("<p><table align='left' border='0' bgcolor='white' width='100%' height='100%'><tr aligh='left'><td><img width='64' height='64' src='" + p.getProjectFodoURL()
				+ "'></img></td>");
		sb.appendHtmlConstant("<td width='100%' align='left'><table width='100%' height='100%'><tr><td><b>");
		sb.appendEscaped(p.getProjectname());
		sb.appendHtmlConstant("</b></td></tr>");
		sb.appendHtmlConstant("<tr><td>");

		if (value.isOwner())
			sb.appendEscaped("Owning ");
		if (value.isParticipating())
			sb.appendEscaped("Participating ");
		if (value.isFollowing())
			sb.appendEscaped("Following ");

		sb.appendHtmlConstant("</td></tr></table></td></tr></table></p>");

	}

}
